﻿using RecordBill.Dtos;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RecordBill.Extensions
{
    internal class PrismManager
    {

        public const string OtherKey = "OtherKey";
        public static List<UIComboxItem> ClassifyItems;
        static PrismManager()
        {
            StatisticKeys = new Dictionary<string, List<string>>();

            StatisticKeys.Add("餐饮", new List<string>()
            {
                "卤菜",
                "汤包",
                "拉面",
                "谷田里",
                "餐饮",
                "池饭",
                "食品经营部",
                "冰粉之醉",
                "十里面香",
                "卤鸭",
                "鸡公煲",
                "豆花馆",
                "快餐",
                "煎饼",
                "莱斯联盟",
                "铺盖面",
                "义门白家",
                "烤肉"

            });

            StatisticKeys.Add("购物", new List<string>()
            {
                "汤包",
                "超市",
                "便利店",
                "凯辉",
                "罗森",
            });

            StatisticKeys.Add("交通", new List<string>()
            {
               "交通卡"
            });
            StatisticKeys.Add("生活", new List<string>()
            {
                "电信",
                "联通",
                "移动",
            });
            StatisticKeys.Add("医疗", new List<string>()
            {
                "重医附一院",
                "医院",

            });
            StatisticKeys.Add("教育", new List<string>()
            {
                "书店",
                
            });
            StatisticKeys.Add("服务", new List<string>()
            {
                "A泽龙SQ",
            });
            StatisticKeys.Add("其他", new List<string>()
            {

            });
            int i = 0;
            ClassifyItems = new List<UIComboxItem>();
            foreach (var key in StatisticKeys)
            {
                var CbxItem = new UIComboxItem()
                {
                    Value = i,
                    Text=key.Key
                };
                ClassifyItems.Add(CbxItem);
            }

        }
        public const string RegionName = "MainRegion";

        public static Dictionary<string, List<string>> StatisticKeys;

      

        public static string GetBillTypeKey(string text)
        {
            var dic = StatisticKeys;

            foreach (var key in dic.Keys)
            {
                var list = dic[key];

                var find = list.Find(a => text.IndexOf(a) > -1);
                if (find != null)
                {
                    return key;
                }
            }
            return "其他";
        }
    }
}
